Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

348
Views
Conflicting with parent property "description" in Swift

I'm using EVNetworkningObject of EVReflection library to serialize or deserialize json response from web service. It means I can't change the property name "description" as "description_" or something like that. At the same time, backend will not change their response property for me. How possibly can I fix this error?

enter image description here

The error message says

Getter for 'description' with Objective-C selector 'description' conflicts with getter for 'description' from superclass 'NSObject' with the same Objective-C selector

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

description is a property of the protocol named NSObjectProtocol of NSObject.

public var description: String { get }

So you can't initiate any variable with the same name in any NSObject subclasses.

For more please visit https://developer.apple.com/documentation/objectivec/nsobjectprotocol/1418746-description.

Please try either by initiating the variable with different names or by implementing with Codable protocol of what @vadian suggested in comments.

over 4 years ago · Santiago Trujillo Report

0

The by far easiest work-around with be to rename the property. Ex: var announcementDescription : String?

over 4 years ago · Santiago Trujillo Report

0

I assume you are using JSON decodable for getting JSON data. if so , You don't need to make your super class of type NSObject. The reason you are getting this error is because the name conflicts with getter for 'description' from superclass 'NSObject'. So make EVNetworking(which is your super class) object a class which conforms to only decodable protocol and not a class of type NSObject.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!